<?php

namespace app\common\model;

/**
 * 问卷模型
 * Class Article
 * @package app\common\model
 */
class Survey extends BaseModel
{
    protected $name = 'survey';
    // protected $append = ['show_views'];

    
    /**
     * 详情
     * @param $article_id
     * @return null|static
     * @throws \think\exception\DbException
     */
    public static function detail($id)
    {
        return self::get($id, ['survey_question']);
    }
    /**
     * 关联
     * @return \think\model\relation\HasOne
     */
    public function surveyQuestion()
    {
        $module = self::getCalledModule() ?: 'common';
        // dump($module);die;
        return $this->hasMany('SurveyQuestion', 'survey_id', 'id');
    }

    /**
     * 关联
     * @return \think\model\relation\BelongsTo
     */
    // public function category()
    // {
    //     $module = self::getCalledModule() ?: 'common';
    //     return $this->BelongsTo("app\\{$module}\\model\\article\\Category");
    // }
}
